import 'package:flutter/material.dart';
import 'package:jd_flutter/base/foundation/flutter_extension.dart';

class DetailPage extends StatefulWidget {
  final Map<String, dynamic> params;
  const DetailPage({Key? key, required this.params}) : super(key: key);
  get data => params.getStringNotNull('data');

  @override
  State<DetailPage> createState() => _DetailPageState();
}

class _DetailPageState extends State<DetailPage> {
  @override
  void initState() {
    super.initState();
    print('DetailPageState initState--------->');
  }

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
    print('DetailPageState didChangeDependencies--------->');
  }

  @override
  void deactivate() {
    super.deactivate();
    print('DetailPageState deactivate---------->');
  }

  @override
  void dispose() {
    super.dispose();
    print('DetailPageState dispose---------->');
  }

  @override
  Widget build(BuildContext context) {
    print('DetailPageState build--------->');

    return Scaffold(
      appBar: AppBar(title: const Text("DetailPage ")),
      body: Center(
        child: ElevatedButton(
          child: Text(widget.data ?? ""),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
      ),
    );
  }
}
